package com.bckj.freshnow.cart.mapper;

import com.bckj.freshnow.cart.entity.CartItem;
import com.bckj.freshnow.cart.model.CartItemQuery;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bckj.freshnow.cart.model.CartItemVO;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.jdbc.SQL;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 购物车商品表(CartItem)表数据库访问层
 *
 * @author makejava
 * @since 2025-04-28 15:28:37
 */
@Mapper
public interface CartItemMapper extends BaseMapper<CartItem> {

    /**
      * 列表
      *
      * @param query req
      * @return list
      */
    @SelectProvider(method = "findAll" , type = CartItemProvider.class)
    List<CartItemVO> findAll(CartItemQuery query);
    
    class CartItemProvider{
        
        public String findAll(CartItemQuery query) {
            SQL sql = new SQL();
            sql.SELECT("id, cart_id, sku_id, goods_id, shop_id, quantity, selected, source_type, source_id, price_snapshot, weight, warehouse_id, vendor_id, create_time, update_time, ");
            sql.FROM("cart_item");
            return sql.toString();
        }
    }
}

